home *** CD-ROM | disk | FTP | other *** search
- /*
- * 32K色画像圧縮/展開関数 V0.01
- * Copyright(C) おこめ 1992
- */
-
- #define WORD(x) *((unsigned short int *)(x))
-
- /* ヒソイス型 */
- int ask(o, i, x, y)
- char *o, *i;
- int x, y;
- {
- int j, p = 0, p2 = 0;
- WORD(o)=WORD(i) & 0x7fff;
- for (j = 2; j < x * y * 2; j+=2)
- {
- if ((WORD(i + j) & 0x7fff) == (WORD(i + j - 2) & 0x7fff))
- {
- WORD(o + p) = WORD(o + p) | 0x8000;
- WORD(o + p + 2) = WORD(o + p + 2) + 1;
- p2 = 4;
- }
- else
- {
- p+=p2;
- WORD(o + p) = WORD(i + j) & 0x7fff;
- WORD(o + p + 2) = 0;
- p2 = 2;
- }
- }
- return (p + p2);
- }
-
-
- void tki(o, i, x, y)
- char *o, *i;
- int x, y;
- {
- int k, j = 0;
- for (k = 0; k < x * y * 2; k+=2);
- {
- if (WORD(i + j) & 0x8000 == 0)
- {
- WORD(o + k) = WORD(i + j);
- j+=2;
- }
- else
- {
- WORD(o + k) = WORD(i + j) & 0x7fff;
- WORD(i + j + 2) = WORD(i + j + 2) - 1;
- if (WORD(i + j + 2) == 0xffff)
- {
- j+=4;
- }
- }
- }
- }
-